package com.shuziren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shuziren.abnormal.CustomException;
import com.shuziren.mapper.InterviewRecoverMapper;
import com.shuziren.pojo.entity.InterviewRecover;
import com.shuziren.pojo.vo.InterviewRecoverQueryVo;
import com.shuziren.service.InterviewRecoverService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class InterviewRecoverServiceImpl extends ServiceImpl<InterviewRecoverMapper, InterviewRecover> implements InterviewRecoverService {

    @Override
    public Page<InterviewRecover> selectByConditionWithPage(InterviewRecoverQueryVo queryVo, Page<InterviewRecover> page) {
        QueryWrapper<InterviewRecover> wrapper = new QueryWrapper<>();
        if (queryVo.getCandidateId() != null && queryVo.getCandidateId() != 0) {
            wrapper.eq("candidate_id", queryVo.getCandidateId());
        }
        if (queryVo.getQuestionId() != null && queryVo.getQuestionId() != 0) {
            wrapper.eq("question_id", queryVo.getQuestionId());
        }
        return page(page, wrapper);
    }
}